package com.it.springboot_day01demo.service.impl;

import com.it.springboot_day01demo.bean.Emp;
import com.it.springboot_day01demo.mapper.EmpMapper;
import com.it.springboot_day01demo.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class EmpServiceImp implements EmpService {
    @Autowired
    private EmpMapper empMapper;

    @Override
    public int addEmpBy(Emp emp) {
        return empMapper.insert(emp);
    }

    @Override
    public List<Emp> selectAllEmpList() {
        return empMapper.selectList(null);
    }

    @Override
    public int updateEmpById(Emp emp) {
        //update emp
        return empMapper.updateById(emp);
    }
}
